<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>ReplaceString</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">ReplaceString()</font></b></p>
<p><b>Syntax</b></p><blockquote>

String$ = <font color="#006666"><b>ReplaceString</b></font>(String$, StringToFind$, ReplacementString$ [, Mode [, StartPosition [, NbOccurrences]]])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>



Try to find any occurrences of 'StringToFind$' in the given 'String$' and replace them 
with 'ReplacementString$'. 

 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>String$</i></td>
<td width="90%"> 
 
The string to use. 

 

</td></tr>
<tr><td><i>StringToFind$</i></td>
<td> 
 
The string to find. 

 

</td></tr>
<tr><td><i>ReplacementString$</i></td>
<td> 
 
The string to use as replacement. 

 

</td></tr>
<tr><td><i>Mode (optional)</i></td>
<td> 
 
It can be a combination of the following values: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_String_CaseSensitive</font> : Case sensitive search (a=a) (default)
  <font color="#924B72">#PB_String_NoCase</font> : Case insensitive search (A=a)
  <font color="#924B72">#PB_String_InPlace</font>: In-place replacing. This means that the string is replaced directly in the memory.
                      The 'StringToFind$' and 'ReplacementString$' parameter must have the same length. This is
                      a dangerous option, for advanced users only. The advantage is the very high speed of the
                      replacement. When using this option, the result of ReplaceString() has to be ignored (and
                      not affected to something, as this is the string passed in parameter which is changed).
</font></pre>

</td></tr>
<tr><td><i>StartPosition (optional)</i></td>
<td> 
 
Specifies the character position to start the replacement. The first character position is 1. 
If omitted the whole string is used. 

 

</td></tr>
<tr><td><i>NbOccurrences (optional)</i></td>
<td> 
 
Specifies how many strings should be replaced before stopping the operation. If omitted, all strings 
are replaced. 

 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>



A new string with the replaced strings (see the <font color="#924B72">#PB_String_InPlace</font> mode for a different behavior). 

 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">Debug</font></b> <font color="#006666">ReplaceString</font>("This is Art", " is", " was") <font color="#006666">; Will display "This was Art"</font>
  <b><font color="#006666">Debug</font></b> <font color="#006666">ReplaceString</font>("Hello again, hello again", "HELLO", "oh no...", 1, 10) <font color="#006666">; Will display "Hello again, oh no... again"</font>

  test$ = "Bundy, Barbie, Buddy"
<font color="#006666">  ReplaceString</font>(test$, "B", "Z", 2, 1)  <font color="#006666">; all B gets changed to Z  (directly in memory, no valid return-value here)</font>
  <b><font color="#006666">Debug</font></b> test$   <font color="#006666">; Output of the changed string</font>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="removestring.html">RemoveString()</a>, <a href="insertstring.html">InsertString()</a> 

</Blockquote><p><b>Supported OS  </b><Blockquote>All</Blockquote></p><center>&lt;- <a href=removestring.html>RemoveString()</a> - <a href=index.html>String Index</a> - <a href=reversestring.html>ReverseString()</a> -&gt;



</body></html>